<!DOCTYPE html>
<html  lang="en">
    <head>
        <title>Document</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    </head>
    <body>
        <div id="app">
			<div>子组件</div>
			<child @wechat="parentmsg = $event"></child>						
			
			
			<div>父组件</div>
			<textarea v-model="parentmsg"></textarea>			
			
        </div>

        <script>
            Vue.component("child",{
				template: 
				`<div>
					<textarea v-model="childmsg"></textarea>					<br>
					<button @click="$emit('wechat',childmsg)">发送</button>
				</div>`,
            
                data(){
                    return { childmsg: 'How are you?' }
                }
            })
            let vm = new Vue({
                el: '#app',
                data: {
                    parentmsg: '',
                }
            })
        </script>
    </body>
</html>